package com.atguigu.day08.p1;

import java.util.Scanner;

/**
 * @version 1.0
 * @Author 马冰
 * @Date 2024/11/8 8:40
 * @注释
 */
public class Morning {
    String name;
    int age;


    public void showNameAge(String name, int age){
        this.name = name;
        this.age = age;
        System.out.println("名字: " + this.name + ", 年龄: " + this.age);

    }

    public int sum(int a, int b){
//        a = (int)(Math.random() * 101);
//        b = (int)(Math.random() * 101);
        return a + b;
    }
}

class MorningTest{
    public static void main(String[] args) {
        Morning morning = new Morning();
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入名字: ");
        String name = sc.nextLine();
        System.out.println("请输入年龄: ");
        int age = sc.nextInt();
        morning.showNameAge(name, age);

        System.out.println("请输入两个整数: ");
        int sum = sc.nextInt();
        int sum1 = sc.nextInt();
        System.out.println("两个数的和是: " + morning.sum(sum, sum1));

    }
}
